home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
pasprog.EXE
/
KALIN-IS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1980-01-10
|
2KB
|
90 lines
Program Matris;
Uses crt;
Var
a : array[1..3,1..4] of real;
Procedure matris_al;
var i,j:integer;
begin
for i:=1 to 3 do
begin
for j:=1 to 4 do
begin
gotoxy(j*4,i*2);read(a[i,j]);
end;
end; { for }
end; { matris_al }
Procedure matris_yaz;
var i,j:integer;
begin
for i:=1 to 3 do
begin
for j:=1 to 4 do
write(a[i,j]:2:1,' ');{üç boƒluk}
writeln;
end; { for }
end; { matris_yaz }
Procedure birinci;
var
i,j : integer;
oran2,oran3 : real;
begin
oran2:=a[2,1]/a[1,1];
oran3:=a[3,1]/a[1,1];
writeln('R2 = R2 -(',a[2,1]:2:1,'/',a[1,1]:2:1,')*','R1');
writeln('R3 = R3 -(',a[3,1]:2:1,'/',a[1,1]:2:1,')*','R1');
writeln;
for j:=1 to 4 do
a[2,j]:=a[2,j]-oran2*a[1,j];
for j:=1 to 4 do
a[3,j]:=a[3,j]-oran3*a[1,j];
end; { birinci }
Procedure ikinci;
var
j : integer;
oran33 : real;
begin
oran33:=a[3,2]/a[2,2];
writeln('R3 = R3 -(',a[3,2]:2:1,'/',a[2,2]:2:1,')*R2');
writeln;
for j:=1 to 4 do
a[3,j]:=a[3,j]-oran33*a[2,j];
end;
Procedure sonuc_yaz;
var
x1,x2,x3:real;
begin
writeln('üçüncü satìrdan yararlanarak:');
x3:=a[3,4]/a[3,3];
writeln('X3=',x3:2:1);
writeln('X3''ü ikinci satìrda yerine koyarsak:');
x2:=(a[2,4]-a[2,3]*x3)/a[2,2];
writeln('X2=',x2:2:1);
writeln('X2 ve X3''ü ilk satìrda yerlerine koyarsak:');
x1:=(a[1,4]-a[1,3]*x3-a[1,2]*x2)/a[1,1];
writeln('X1=',x1:2:1);
end; { sonuc_yaz }
BEGIN
clrscr;
matris_al;
birinci;
matris_yaz;
ikinci;
matris_yaz;
sonuc_yaz;
END.